package com.zbkj.dal.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.ObjectUtils;

import java.util.Arrays;

/**
 * @author tianzhonghai
 * 2023/11/23 17:01
 */
@Getter
@AllArgsConstructor
public enum OrderOperateRecordTypeEnum {


    BACK(1, "已归还"),
    SCRAP(2, "其他问题"),
    ;

    private final Integer type;
    private final String name;

    public static String toName(Integer type) {
        if (type == null) {
            return "";
        }

        return Arrays.stream(OrderOperateRecordTypeEnum.values()).filter(p -> ObjectUtils.nullSafeEquals(p.getType(), type))
                .map(m -> m.getName()).findFirst().orElse("");
    }

}
